package cn.wildfire.chat.app;

import android.os.Environment;
import android.util.Log;

import java.util.ArrayList;
import java.util.List;

import cn.wildfire.chat.app.extendsion.utils.TextUtils;
import cn.wildfire.chat.app.extendsion.utils.VariableFilesUtils;

/**
 * Created by heavyrain lee on 2017/11/24.
 */
public class Config {


    /********************** Server ***********************/

    //本地服务配置
    /*public static final String IM_SERVER_HOST = "192.168.1.218";
    public static final int IM_SERVER_PORT = 80;

    public static final String APP_SERVER_HOST = "192.168.1.218";
    public static final int APP_SERVER_PORT = 8888;

    public static final String ICE_ADDRESS = "turn:120.79.64.45:3478";
    public static final String ICE_USERNAME = "sourcemuch";
    public static final String ICE_PASSWORD = "Sourcemuch123";*/

    //ll地址
    // 阿里服务器配置
//    public static final String IM_SERVER_HOST = "159.75.19.170";
    public static final String IM_SERVER_HOST = "192.168.0.169";//trj
//    public static final String IM_SERVER_HOST = "192.168.0.141";//yzh

    public static final int IM_SERVER_PORT = 83;

    public static final String APP_SERVER_HOST = "";
    public static final int APP_SERVER_PORT = 0;

    //    public static final String ICE_ADDRESS = "turn:120.79.64.45:3478";
//    public static final String ICE_USERNAME = "sourcemuch";
//    public static final String ICE_PASSWORD = "Sourcemuch123";
//    public static final String ICE_ADDRESS = "turn:134.175.3.147:3478";
//    public static final String ICE_USERNAME = "zjf";
//    public static final String ICE_PASSWORD = "123456";
    public static final String ICE_ADDRESS = "turn:159.75.19.170:3478";
    public static final String ICE_USERNAME = "zll";
    public static final String ICE_PASSWORD = "Zll2020tiM";

    // 测试服配置
    /*public static final String IM_SERVER_HOST = "192.168.1.36";
    public static final int IM_SERVER_PORT = 80;

    public static final String APP_SERVER_HOST = "192.168.1.36";
    public static final int APP_SERVER_PORT = 8888;

    public static final String ICE_ADDRESS = "turn:3.113.205.41:3478";
    public static final String ICE_USERNAME = "sourcemuch";
    public static final String ICE_PASSWORD = "Sourcemuch123";*/

    // 客户服务器配置
   /*public static final String IM_SERVER_HOST = "175.41.223.175";
    public static final int IM_SERVER_PORT = 80;

    public static final String APP_SERVER_HOST = "3.113.205.41";
    public static final int APP_SERVER_PORT = 8888;

    public static final String ICE_ADDRESS = "turn:3.113.205.41:3478";
    public static final String ICE_USERNAME = "sourcemuch";
    public static final String ICE_PASSWORD = "Sourcemuch123";*/

    // 野火IM中的官方Turn配置
   /* public static final String ICE_ADDRESS = "turn:turn.liyufan.win:3478";
    public static final String ICE_USERNAME = "wfchat";
    public static final String ICE_PASSWORD = "wfchat";*/

    // 其他信息，勿动
    public static final int DEFAULT_MAX_AUDIO_RECORD_TIME_SECOND = 120;

    public static String VIDEO_SAVE_DIR;
    public static String AUDIO_SAVE_DIR;
    public static String PHOTO_SAVE_DIR;
    public static String FILE_SAVE_DIR;

    public static String ROOT_CACHE_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + "/sourcemuch/";

    /**
     * 设置当前登入的用户id，用于区分用户存储资源数据路径
     *
     * @param userId
     */
    public static void setCurrentLoginUserIdForCacheSet(String userId) {
        if (TextUtils.isTextEmpty(userId)) {
            return;
        }
        Config.VIDEO_SAVE_DIR = ROOT_CACHE_PATH + userId + "/video/";
        Config.AUDIO_SAVE_DIR = ROOT_CACHE_PATH + userId + "/audio/";
        Config.PHOTO_SAVE_DIR = ROOT_CACHE_PATH + userId + "/photo/";
        Config.FILE_SAVE_DIR = ROOT_CACHE_PATH + userId + "/file/";
        List<String> cachePathList = new ArrayList<>();
        cachePathList.add(Config.VIDEO_SAVE_DIR);
        cachePathList.add(Config.AUDIO_SAVE_DIR);
        cachePathList.add(Config.PHOTO_SAVE_DIR);
        cachePathList.add(Config.FILE_SAVE_DIR);
        List<Boolean> cacheDirectionList = new ArrayList<>();
        for (int i = 0; i < cachePathList.size(); i++) {
            Boolean b = true;
            cacheDirectionList.add(b);
        }
        VariableFilesUtils.asyncCreateMuch(cachePathList, null, cacheDirectionList, new VariableFilesUtils.OnNormalOperateStatusListener() {
            @Override
            public void resp(boolean integrated) {
                Log.e("#### Make cache files", " integrated = " + integrated);
            }
        });
    }

    /**
     * 微信第三方配置
     */
    public static final String WXAppID = "wxff455f294aeb42b8";
    public static final String WXAppSecret = "0c50e026806bfb347dbf7ec9a10b85c6";

}
